﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Newtonsoft.Json;
using Data;
using Service;

public partial class NuevaRevisita : System.Web.UI.Page
{
    protected void Page_PreRender(object sender, EventArgs e)
    {
        this.Page.ClientScript.RegisterClientScriptInclude("Maps_Scriptage", "JavaScript/Maps_Scriptage.js");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        CheckPostBack();
    }

    public void CheckPostBack()
    {
        if (((string)Request.Params["__EVENTTARGET"]) == "Marcar")
        {
            string response = ((string)Request.Params["__EVENTARGUMENT"]);
            SimplePersona deserializedP = JsonConvert.DeserializeObject<SimplePersona>(response);
            Persona p = new VisitadorSvr().GetPersonaFromSimple(deserializedP);
            this.Page.ClientScript.RegisterClientScriptBlock(typeof(string), "SetPosition", "window.addEvent('domready', function(){checkPosicion('" + p.PosicionActual.Calle + "','" + p.PosicionActual.Numero + "','" + p.PosicionActual.Localidad + "','" + p.PosicionActual.Provincia + "','" + p.Simple.Nombre + "' );} );", true);


        }
    }

    protected void LnkSalir_Click(object sender, EventArgs e)
    {
        Response.Redirect("Default.aspx");
    }
}